home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / cawf404.zip / cawf.h < prev    next >
C/C++ Source or Header  |  1993-12-07  |  11KB  |  281 lines

  1. /*
  2.  *    cawf.h - definitions for cawf(1)
  3.  */
  4.  
  5. /*
  6.  *    Copyright (c) 1991 Purdue University Research Foundation,
  7.  *    West Lafayette, Indiana 47907.  All rights reserved.
  8.  *
  9.  *    Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
  10.  *    University Computing Center.  Not derived from licensed software;
  11.  *    derived from awf(1) by Henry Spencer of the University of Toronto.
  12.  *
  13.  *    Permission is granted to anyone to use this software for any
  14.  *    purpose on any computer system, and to alter it and redistribute
  15.  *    it freely, subject to the following restrictions:
  16.  *
  17.  *    1. The author is not responsible for any consequences of use of
  18.  *       this software, even if they arise from flaws in it.
  19.  *
  20.  *    2. The origin of this software must not be misrepresented, either
  21.  *       by explicit claim or by omission.  Credits must appear in the
  22.  *       documentation.
  23.  *
  24.  *    3. Altered versions must be plainly marked as such, and must not
  25.  *       be misrepresented as being the original software.  Credits must
  26.  *       appear in the documentation.
  27.  *
  28.  *    4. This notice may not be removed or altered.
  29.  */
  30.  
  31. #include <stdio.h>
  32. #ifdef    UNIX
  33. #include <sys/types.h>
  34. #else
  35. #include <sys\types.h>
  36. #endif
  37. #include "regexp.h"
  38. #include "cawflib.h"
  39. #include "proto.h"
  40.  
  41. #define    DEFLLLT        78            /* default .ll and .lt */
  42. #define    DEFPGLEN    66            /* default .pl */
  43. #define    DEVCONFIG    "device.cf"        /* device configuration file */
  44. #define ESC        '\033'            /* ESCape character */
  45. #define MAXEXP          30                      /* maximum expressions
  46.                          * (and TABs) */
  47. #define MAXFILES        10            /* maximum files (including
  48.                          * *.dev, common and *.mac) */
  49. #define MAXFSTK        5            /* maximum file stack
  50.                          * (for .so) */
  51. #define MAXHYCH        10            /* maximum hyphen characters */
  52. #define MAXLINE         256            /* maximum line length */
  53. #define MAXMACRO        100            /* maximum number of macros */
  54. #define MAXMTXT         1024            /* maximum macro text lines */
  55. #define MAXNHNR        10            /* maximum ".NH" numbers
  56.                          * (but 0 not used) */
  57. #define MAXNR        50            /* maximum number reg */
  58. #define MAXOLL        512            /* maximum output line length */
  59. #define    MAXSCH        256            /* maximum special characters */
  60. #define MAXSP        25            /* maximum stack pointer (for
  61.                          * nesting of macro calls) */
  62. #define MAXSTR        100            /* maximum ".ds" strings */
  63.  
  64. /*
  65.  * Output line adjustment modes
  66.  */
  67.  
  68. #define LEFTADJ        0
  69. #define RIGHTADJ    1
  70. #define BOTHADJ        2
  71.  
  72. /*
  73.  * Error handling codes
  74.  */
  75.  
  76. #define    FATAL        0            /* fatal error */
  77. #define    LINE        0            /* display line */
  78. #define    NOLINE        1            /* don't display line */
  79. #define WARN        1            /* warning error */
  80.  
  81. /*
  82.  * Padding directions
  83.  */
  84.  
  85. #define    PADLEFT        0            /* pad from left */
  86. #define PADRIGHT    1            /* pad from right */
  87.  
  88. /*
  89.  * Pass 3 signal codes
  90.  */
  91.  
  92. #define NOBREAK        -1
  93. #define DOBREAK        -2
  94. #define MESSAGE        -3
  95. #define    RAWLINE        -4
  96.  
  97. /*
  98.  * Macro argument types
  99.  */
  100.  
  101. #define    MANMACROS    1            /* -man */
  102. #define MEMACROS    2            /* -me */
  103. #define MSMACROS    3            /* -ms */
  104.  
  105.  
  106. struct fcode {
  107.     unsigned char nm;        /* font name character */
  108.     unsigned char status;        /* status */
  109. };
  110.  
  111. struct fontstr {            /* font control strings */
  112.  
  113.     unsigned char *i;        /* font initialization string */
  114.     int il;                /* length of *i */ 
  115.     unsigned char *b;        /* bold */
  116.     int bl;                /* length of *bb */
  117.     unsigned char *it;        /* italic */
  118.     int itl;            /* length of *itb */
  119.     unsigned char *r;        /* roman string */
  120.     int rl;                /* length of *r */
  121. }; 
  122.  
  123. struct hytab {
  124.     unsigned char font;        /* font name character */
  125.     int len;            /* effective length */
  126.     unsigned char *str;        /* value string */
  127. };
  128.  
  129. struct macro {
  130.         unsigned char name[2];        /* macro name */
  131.         int bx;                /* beginning Macrotxt[] index */
  132.     int ct;                /* index count */
  133. };
  134.  
  135. struct nbr {
  136.     unsigned char nm[2];        /* register name */
  137.     int val;            /* value */
  138. };
  139.  
  140. struct parms {
  141.     char nm[2];            /* parameter name */
  142.     char *cmd;            /* pass 3 command */
  143.     int cmdl;            /* pass 3 command length */
  144.     int val;                        /* current value */
  145.     int prev;                       /* previous value */
  146. };
  147.  
  148. struct pgrange {
  149.     int l;                /* lower bound */
  150.     int u;                /* upper bound */
  151.     struct pgrange *next;        /* next range specification */
  152. };
  153.  
  154. struct rx {
  155.     char *re;            /* regular expression */
  156.     struct regexp *pat;        /* compiled pattern */
  157. };
  158.  
  159. struct scale {
  160.     unsigned char nm;        /* scale factor name */
  161.     double val;            /* value */
  162. };
  163.  
  164. struct schtab {
  165.     unsigned char nm[2];        /* character name */
  166.     int len;            /* effective length */
  167.     unsigned char *str;        /* value string */
  168. };
  169.  
  170. struct str {
  171.     unsigned char nm[2];        /* string name */
  172.     unsigned char *str;        /* string value */
  173. };
  174.  
  175. extern int Adj;                /* output line adjustment mode */
  176. extern unsigned char *Aftnxt;        /* action after next line */
  177. extern unsigned char *Args[];        /* macro arguments */
  178. extern unsigned char *Argstack[];    /* stack for Expand()'s "args[]" */
  179. extern int Backc;                       /* last word ended with '\\c' */
  180. extern int Botmarg;            /* bottom margin */
  181. extern int Centering;                   /* centering count */
  182. extern int Condstack[];                 /* stack for Expand()'s "cond" */
  183. extern unsigned char *Cont;        /* continue line append */
  184. extern int Contlen;            /* continue line append length */
  185. extern int Curmx;                     /* current macro name */
  186. extern char *Device;            /* output device name */
  187. extern char *Devconf;            /* device configuration file path */
  188. extern char *Devfont;            /* output device font */
  189. extern int Divert;            /* diversion status */
  190. extern FILE *Efs;            /* error file stream pointer */
  191. extern unsigned char *Eol;        /* end of line information */
  192. extern int Eollen;            /* end of line length */
  193. extern int Err;                         /* error flag */
  194. extern unsigned char *F;        /* field value */
  195. extern struct fcode Fcode[];        /* font codes */
  196. extern int Fill;            /* fill status */
  197. extern int Firstpg;            /* first page print status */
  198. extern unsigned char Font[];        /* current font */
  199. extern int Fontctl;            /* output font control */
  200. extern char Fontstat;            /* output font status */
  201. extern int Fph;                /* first page header status */
  202. extern int Fsp;                         /* files stack pointer (for .so) */
  203. extern struct fontstr Fstr;        /* font control strings */
  204. extern unsigned char *Ftc;        /* center footer */
  205. extern unsigned char *Ftl;        /* left footer */
  206. extern unsigned char *Ftr;        /* right footer */
  207. extern unsigned char *Hdc;        /* center header */
  208. extern int Hdft;            /* header/footer status */
  209. extern unsigned char *Hdl;        /* left header */
  210. extern unsigned char *Hdr;        /* right header */
  211. extern FILE *Ifs;            /* input file stream */
  212. extern FILE *Ifs_stk[];            /* Ifs stack */
  213. extern int Ind;                         /* indentation amount */
  214. extern unsigned char *Inname;        /* input file name */
  215. extern unsigned char *Inn_stk[];    /* Inname stack */
  216. extern struct hytab Hychar[];           /* hyphen characters */
  217. extern int LL;                /* line length */
  218. extern int LT;                /* 3-part title length */
  219. extern unsigned char Line[];        /* input line */
  220. extern int Lockil;            /* pass 2 line number is locked
  221.                      * (processing is inside macro) */
  222. extern int Marg;                        /* macro argument - man, ms, etc. */
  223. extern struct macro Macrotab[];         /* macro table */
  224. extern int Macrostack[];                /* stack for Expand()'s "macro" */
  225. extern unsigned char *Macrotxt[];    /* macro text */
  226. extern int Mtx;                         /* macro text index */
  227. extern int Mxstack[];                   /* stack for Expand()'s "mx" */
  228. extern int Nhnr[];            /* ".NH" numbers */
  229. extern int Nhy;                         /* number of Hychar[] entries */
  230. extern int Nleftstack[];                /* stack for Expand()'s "nleft" */
  231. extern int Nmac;                        /* number of macros */
  232. extern int Nnr;                         /* number of Numb[] entries */
  233. extern int Nospmode;            /* no space mode */
  234. extern int NR;                          /* number of record, ala awk */
  235. extern int NR_stk[];            /* NR stack */
  236. extern int Nsch;                        /* number of Schar[] entries */
  237. extern int Nstr;